package stdio.costa.moca.pdf;

import java.util.Iterator;

import com.aspose.words.Cell;
import com.aspose.words.Row;
import com.aspose.words.Table;

public class TableVisitableDecorator {
	
	private Table table;
	
	public TableVisitableDecorator(Table table) {
		this.table = table;
	}
	
	public void accept(TableVisitor visitor) throws Exception {
		Iterator<Row> rowIterator = table.getRows().iterator();
		while(rowIterator.hasNext()) {
			Row row = rowIterator.next();
			Iterator<Cell> cellIterator = row.getCells().iterator();
			while(cellIterator.hasNext()) {
				visitor.visit(cellIterator.next());
			}
			visitor.visit(row);
		}
		visitor.visit(table);
	}
}
